this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};(function(e,t){"use strict";function a(e,t){l(e,t);t.add(e)}function i(e,t,a){l(e,t);t.set(e,a)}function l(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function s(e,t,a){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return a}var r=new WeakMap;var n=new WeakMap;var b=new WeakMap;var d=new WeakMap;var v=new WeakMap;var c=new WeakMap;var h=new WeakMap;var p=new WeakMap;var u=new WeakMap;var o=new WeakMap;var P=new WeakMap;var F=new WeakMap;var w=new WeakMap;var H=new WeakMap;var I=new WeakMap;var G=new WeakMap;var k=new WeakMap;var S=new WeakMap;var A=new WeakMap;var f=new WeakMap;var L=new WeakSet;var E=new WeakSet;var M=new WeakSet;var T=new WeakSet;var D=new WeakSet;var g=new WeakSet;var W=function e(l){babelHelpers.classCallCheck(this,e);a(this,g);a(this,D);a(this,T);a(this,M);a(this,E);a(this,L);i(this,r,{writable:true,value:void 0});i(this,n,{writable:true,value:void 0});i(this,b,{writable:true,value:void 0});i(this,d,{writable:true,value:void 0});i(this,v,{writable:true,value:void 0});i(this,c,{writable:true,value:void 0});i(this,h,{writable:true,value:void 0});i(this,p,{writable:true,value:void 0});i(this,u,{writable:true,value:void 0});i(this,o,{writable:true,value:void 0});i(this,P,{writable:true,value:void 0});i(this,F,{writable:true,value:void 0});i(this,w,{writable:true,value:void 0});i(this,H,{writable:true,value:void 0});i(this,I,{writable:true,value:void 0});i(this,G,{writable:true,value:void 0});i(this,k,{writable:true,value:void 0});i(this,S,{writable:true,value:void 0});i(this,A,{writable:true,value:void 0});i(this,f,{writable:true,value:"/bitrix/services/main/ajax.php?action=landing.api.landing.getById&landingId=#id#"});babelHelpers.classPrivateFieldSet(this,r,l.siteId);babelHelpers.classPrivateFieldSet(this,n,l.siteType);babelHelpers.classPrivateFieldSet(this,b,l.folderId);babelHelpers.classPrivateFieldSet(this,d,l.selectorCreateIndex);babelHelpers.classPrivateFieldSet(this,v,l.selectorIndexMetaBlock);babelHelpers.classPrivateFieldSet(this,c,l.selectorSelect);babelHelpers.classPrivateFieldSet(this,h,l.selectorPageLink);babelHelpers.classPrivateFieldSet(this,p,l.selectorFieldId);babelHelpers.classPrivateFieldSet(this,u,l.selectorPreviewBlock);babelHelpers.classPrivateFieldSet(this,o,l.selectorPreviewTitle);babelHelpers.classPrivateFieldSet(this,P,l.selectorPreviewDescription);babelHelpers.classPrivateFieldSet(this,F,l.selectorPreviewPicture);babelHelpers.classPrivateFieldSet(this,w,l.selectorPreviewSrcPicture);babelHelpers.classPrivateFieldSet(this,H,l.selectorPreviewPictureWrapper);babelHelpers.classPrivateFieldSet(this,I,l.pathToLandingEdit);babelHelpers.classPrivateFieldSet(this,G,l.pathToLandingCreate);babelHelpers.classPrivateFieldSet(this,k,l.isUseNewMarket);s(this,L,B).call(this);s(this,E,O).call(this);t.Event.bind(babelHelpers.classPrivateFieldGet(this,c),"click",s(this,T,y).bind(this));if(babelHelpers.classPrivateFieldGet(this,d)){t.Event.bind(babelHelpers.classPrivateFieldGet(this,d),"click",s(this,D,m).bind(this))}};function B(){babelHelpers.classPrivateFieldSet(this,S,new BX.Landing.UI.Field.LinkUrl({title:null,content:null,allowedTypes:[BX.Landing.UI.Field.LinkUrl.TYPE_PAGE],options:{siteId:babelHelpers.classPrivateFieldGet(this,r),currentSiteOnly:true,disableAddPage:true,landingId:-1,filter:{ID:babelHelpers.classPrivateFieldGet(this,r),"=TYPE":babelHelpers.classPrivateFieldGet(this,n)},filterLanding:{FOLDER_ID:babelHelpers.classPrivateFieldGet(this,b)}},onInput:s(this,M,_).bind(this)}))}function O(){var e=this;if(!babelHelpers.classPrivateFieldGet(this,w)){return}babelHelpers.classPrivateFieldSet(this,A,new BX.Landing.UI.Field.Image({id:"folderPicture",disableLink:true,disableAltField:true,allowClear:true,content:{src:babelHelpers.classPrivateFieldGet(this,w).getAttribute("value"),id:babelHelpers.classPrivateFieldGet(this,F).getAttribute("value")},uploadParams:{action:"Site::uploadFile",id:babelHelpers.classPrivateFieldGet(this,r)},dimensions:{width:1200,height:1200}}));t.Dom.clean(babelHelpers.classPrivateFieldGet(this,H));t.Dom.append(babelHelpers.classPrivateFieldGet(this,A)["layout"],babelHelpers.classPrivateFieldGet(this,H));babelHelpers.classPrivateFieldGet(this,A)["layout"].addEventListener("input",(function(){var t=babelHelpers.classPrivateFieldGet(e,A).getValue();babelHelpers.classPrivateFieldGet(e,F).setAttribute("value",t["id2x"])}))}function _(e){var t;var a=babelHelpers.classPrivateFieldGet(this,S).getValue();if(a.startsWith("page:")){t=a.substr(13)}else{t=a.substr(8)}var i=babelHelpers.classPrivateFieldGet(this,I).replace("#landing_edit#",t);babelHelpers.classPrivateFieldGet(this,h).innerHTML='<span id="landing-folder-index-link-text" class="landing-folder-index-link-text">'.concat(e,"</span>");babelHelpers.classPrivateFieldGet(this,h).setAttribute("href",i);babelHelpers.classPrivateFieldGet(this,p).setAttribute("value",t);s(this,g,C).call(this,t)}function y(){babelHelpers.classPrivateFieldGet(this,S).onSelectButtonClick()}function m(e){var t={allowChangeHistory:false,events:{onClose:function e(){window.location.reload()}}};if(babelHelpers.classPrivateFieldGet(this,k)){t.cacheable=false;t.customLeftBoundary=0}BX.SidePanel.Instance.open(babelHelpers.classPrivateFieldGet(this,G),t);BX.PreventDefault(e)}function C(e){var t=this;babelHelpers.classPrivateFieldGet(this,u).style.display="block";babelHelpers.classPrivateFieldGet(this,v).style.display="flex";BX.ajax({url:babelHelpers.classPrivateFieldGet(this,f).replace("#id#",e),method:"GET",dataType:"json",onsuccess:function e(a){var i=a.data;if(!i["ADDITIONAL_FIELDS"]){return}var l=i["ADDITIONAL_FIELDS"]["METAOG_TITLE"]||i["TITLE"];var s=i["ADDITIONAL_FIELDS"]["METAOG_DESCRIPTION"]||i["DESCRIPTION"]||"";babelHelpers.classPrivateFieldGet(t,o).setAttribute("value",l);babelHelpers.classPrivateFieldGet(t,P).setAttribute("value",s);babelHelpers.classPrivateFieldGet(t,F).setAttribute("value","");babelHelpers.classPrivateFieldGet(t,F).setAttribute("value",i["ADDITIONAL_FIELDS"]["~METAOG_IMAGE"]||"");babelHelpers.classPrivateFieldGet(t,w).setAttribute("value",i["ADDITIONAL_FIELDS"]["METAOG_IMAGE"]||"");babelHelpers.classPrivateFieldGet(t,A).setValue({src:i["ADDITIONAL_FIELDS"]["METAOG_IMAGE"]||"",id:i["ADDITIONAL_FIELDS"]["~METAOG_IMAGE"]||-1})}})}e.FolderEdit=W})(this.BX.Landing.Component=this.BX.Landing.Component||{},BX);
//# sourceMappingURL=script.map.js